/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadAtendimento.java
 *
 * Created on 19/05/2012, 18:57:51
 */
package View;

import Modelo.Paciente;
import Util.PAPUtil;

/** 
 *
 * @author Rafael
 */
public class CadAtendimento extends javax.swing.JFrame {

    
        PAPUtil pap = new PAPUtil(); // istancia das VALIDACOES
        
    /** Creates new form CadAtendimento */
    public CadAtendimento(int indice) {
        initComponents();
        this.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH);//maximiza tela
        
         // indice 1 ( tela Atendimento)
        // indice 2 ( tela Agendamento)
        if(indice == 1){
            jPnAgendamento.setVisible(false);
            jPnExame.setVisible(false);
            
            jLAgendamento.setVisible(false);
            jBtNovoAgendamento.setVisible(false);
            jBtPesquisar.setVisible(false);
            
        }
        if(indice == 2){
            int controleGravar=1;
            jPnAgendamento.setVisible(false);
            jPnExame.setVisible(false);
            
            jBtPesquisar.setVisible(false);
            
            jCbAgendamentosDoDia.setVisible(false);
            
            jBtNovoExame.setVisible(false);
            jBtIternar.setVisible(false);
            jLAgendamento.setVisible(true);
            jLAtendimento.setVisible(false);
            jMiCadastrar.setVisible(false);
        }
        if(indice == 3){
            int controleGravar=1;
            jPnAgendamento.setVisible(false);
            jPnExame.setVisible(false);
            
            
            jBtNovoAgendamento.setVisible(false);
            jCbAgendamentosDoDia.setVisible(false);
            
            jBtNovoExame.setVisible(false);
            jBtIternar.setVisible(false);
            jLAgendamento.setVisible(true);
            jLAtendimento.setVisible(false);
            jMiCadastrar.setVisible(false);
        }
    }
  
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLAtendimento = new javax.swing.JLabel();
        jLAgendamento = new javax.swing.JLabel();
        jPnAgendamento = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTbAgendamento = new javax.swing.JTable();
        jCbEspecialidadeAgendamento = new javax.swing.JComboBox();
        jTxtDiaInicial = new javax.swing.JFormattedTextField();
        jTxtDataFinal = new javax.swing.JFormattedTextField();
        jLabel1 = new javax.swing.JLabel();
        jBtCancelaAgendamento = new javax.swing.JButton();
        jBtGravarAgendamento = new javax.swing.JButton();
        jPnExame = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTbExame = new javax.swing.JTable();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTaDescricaoExame = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();
        jCbExame = new javax.swing.JComboBox();
        jBtGravarExame = new javax.swing.JButton();
        jBtCancelaExame = new javax.swing.JButton();
        jPnAtendimento = new javax.swing.JPanel();
        jTxtNomeAtendimento = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTaDescricaoAtendimento = new javax.swing.JTextArea();
        jLabel8 = new javax.swing.JLabel();
        jBtPesquisar = new javax.swing.JButton();
        jBtNovoAgendamento = new javax.swing.JButton();
        jCbAgendamentosDoDia = new javax.swing.JComboBox();
        jBtNovoExame = new javax.swing.JButton();
        jBtIternar = new javax.swing.JButton();
        jBtReceita = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMiCadastrar = new javax.swing.JMenuItem();
        jMiSair = new javax.swing.JMenuItem();

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLAtendimento.setText("Atendimento");

        jLAgendamento.setText("Agendamento");

        jPnAgendamento.setBackground(new java.awt.Color(255, 255, 255));
        jPnAgendamento.setBorder(javax.swing.BorderFactory.createTitledBorder("Agendamento"));

        jTbAgendamento.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Médico", "Data", "Hora"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(jTbAgendamento);

        jCbEspecialidadeAgendamento.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Especialidade" }));

        jTxtDiaInicial.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT))));

        jTxtDataFinal.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT))));

        jLabel1.setText("até");

        jBtCancelaAgendamento.setBackground(new java.awt.Color(255, 255, 255));
        jBtCancelaAgendamento.setFont(new java.awt.Font("Arial", 0, 11));
        jBtCancelaAgendamento.setText("Cancelar");
        jBtCancelaAgendamento.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jBtCancelaAgendamento.setBorderPainted(false);
        jBtCancelaAgendamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtCancelaAgendamentoActionPerformed(evt);
            }
        });

        jBtGravarAgendamento.setBackground(new java.awt.Color(255, 255, 255));
        jBtGravarAgendamento.setFont(new java.awt.Font("Arial", 0, 11));
        jBtGravarAgendamento.setText("Gravar");
        jBtGravarAgendamento.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jBtGravarAgendamento.setBorderPainted(false);
        jBtGravarAgendamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtGravarAgendamentoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPnAgendamentoLayout = new javax.swing.GroupLayout(jPnAgendamento);
        jPnAgendamento.setLayout(jPnAgendamentoLayout);
        jPnAgendamentoLayout.setHorizontalGroup(
            jPnAgendamentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnAgendamentoLayout.createSequentialGroup()
                .addGap(72, 72, 72)
                .addComponent(jTxtDiaInicial, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTxtDataFinal, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 114, Short.MAX_VALUE)
                .addComponent(jCbEspecialidadeAgendamento, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnAgendamentoLayout.createSequentialGroup()
                .addContainerGap(62, Short.MAX_VALUE)
                .addGroup(jPnAgendamentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnAgendamentoLayout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnAgendamentoLayout.createSequentialGroup()
                        .addComponent(jBtCancelaAgendamento, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jBtGravarAgendamento, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(30, 30, 30))))
        );
        jPnAgendamentoLayout.setVerticalGroup(
            jPnAgendamentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnAgendamentoLayout.createSequentialGroup()
                .addContainerGap(21, Short.MAX_VALUE)
                .addGroup(jPnAgendamentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCbEspecialidadeAgendamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTxtDiaInicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTxtDataFinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPnAgendamentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jBtGravarAgendamento, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jBtCancelaAgendamento, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPnExame.setBackground(new java.awt.Color(255, 255, 255));
        jPnExame.setBorder(javax.swing.BorderFactory.createTitledBorder("Exame"));

        jTbExame.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Nome", "Descrição"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(jTbExame);

        jTaDescricaoExame.setColumns(20);
        jTaDescricaoExame.setRows(5);
        jScrollPane4.setViewportView(jTaDescricaoExame);

        jLabel2.setText("Descrição");

        jCbExame.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Exame" }));

        jBtGravarExame.setBackground(new java.awt.Color(255, 255, 255));
        jBtGravarExame.setFont(new java.awt.Font("Arial", 0, 11));
        jBtGravarExame.setText("Gravar");
        jBtGravarExame.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jBtGravarExame.setBorderPainted(false);

        jBtCancelaExame.setBackground(new java.awt.Color(255, 255, 255));
        jBtCancelaExame.setFont(new java.awt.Font("Arial", 0, 11));
        jBtCancelaExame.setText("Cancelar");
        jBtCancelaExame.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jBtCancelaExame.setBorderPainted(false);
        jBtCancelaExame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtCancelaExameActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPnExameLayout = new javax.swing.GroupLayout(jPnExame);
        jPnExame.setLayout(jPnExameLayout);
        jPnExameLayout.setHorizontalGroup(
            jPnExameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnExameLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPnExameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnExameLayout.createSequentialGroup()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnExameLayout.createSequentialGroup()
                        .addComponent(jCbExame, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(96, 96, 96)
                        .addComponent(jBtCancelaExame, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jBtGravarExame, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(87, 87, 87))))
        );
        jPnExameLayout.setVerticalGroup(
            jPnExameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnExameLayout.createSequentialGroup()
                .addGroup(jPnExameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnExameLayout.createSequentialGroup()
                        .addGroup(jPnExameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPnExameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jCbExame, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel2))
                            .addGroup(jPnExameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jBtGravarExame, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE)
                                .addComponent(jBtCancelaExame, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 1, Short.MAX_VALUE))
                    .addGroup(jPnExameLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)))
                .addContainerGap())
        );

        jPnAtendimento.setBackground(new java.awt.Color(255, 255, 255));
        jPnAtendimento.setBorder(javax.swing.BorderFactory.createTitledBorder("Atendimento"));

        jTxtNomeAtendimento.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTxtNomeAtendimentoKeyTyped(evt);
            }
        });

        jLabel4.setText("Nome:");

        jTaDescricaoAtendimento.setColumns(20);
        jTaDescricaoAtendimento.setRows(5);
        jScrollPane6.setViewportView(jTaDescricaoAtendimento);

        jLabel8.setText("Descrição");

        jBtPesquisar.setText("Pesquisar");

        javax.swing.GroupLayout jPnAtendimentoLayout = new javax.swing.GroupLayout(jPnAtendimento);
        jPnAtendimento.setLayout(jPnAtendimentoLayout);
        jPnAtendimentoLayout.setHorizontalGroup(
            jPnAtendimentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnAtendimentoLayout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addGroup(jPnAtendimentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPnAtendimentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTxtNomeAtendimento)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 335, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addComponent(jBtPesquisar)
                .addGap(21, 21, 21))
        );
        jPnAtendimentoLayout.setVerticalGroup(
            jPnAtendimentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnAtendimentoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPnAtendimentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnAtendimentoLayout.createSequentialGroup()
                        .addGroup(jPnAtendimentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTxtNomeAtendimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                        .addGap(18, 18, 18)
                        .addGroup(jPnAtendimentoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8))
                        .addGap(0, 13, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnAtendimentoLayout.createSequentialGroup()
                        .addGap(0, 124, Short.MAX_VALUE)
                        .addComponent(jBtPesquisar)))
                .addContainerGap())
        );

        jBtNovoAgendamento.setText("Novo Agendamento");
        jBtNovoAgendamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtNovoAgendamentoActionPerformed(evt);
            }
        });

        jCbAgendamentosDoDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Agendamentos Do Dia" }));

        jBtNovoExame.setText("Exame");
        jBtNovoExame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtNovoExameActionPerformed(evt);
            }
        });

        jBtIternar.setText("Internar");
        jBtIternar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtIternarActionPerformed(evt);
            }
        });

        jBtReceita.setText("Receita");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(39, 39, 39)
                                .addComponent(jBtNovoAgendamento)
                                .addGap(35, 35, 35)
                                .addComponent(jBtNovoExame)
                                .addGap(18, 18, 18)
                                .addComponent(jBtIternar)
                                .addGap(18, 18, 18)
                                .addComponent(jBtReceita))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(153, 153, 153)
                                .addComponent(jLAtendimento)
                                .addGap(18, 18, 18)
                                .addComponent(jLAgendamento)
                                .addGap(66, 66, 66)
                                .addComponent(jCbAgendamentosDoDia, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(29, 29, 29)
                                .addComponent(jPnAtendimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(11, 11, 11)
                        .addComponent(jPnAgendamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(560, 560, 560)
                        .addComponent(jPnExame, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(95, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(13, 13, 13)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLAtendimento)
                            .addComponent(jLAgendamento)
                            .addComponent(jCbAgendamentosDoDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPnAtendimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPnAgendamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBtNovoAgendamento)
                    .addComponent(jBtNovoExame)
                    .addComponent(jBtIternar)
                    .addComponent(jBtReceita))
                .addGap(61, 61, 61)
                .addComponent(jPnExame, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(449, 449, 449))
        );

        jMenu1.setText("Ações");

        jMiCadastrar.setText("Cadastrar");
        jMiCadastrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMiCadastrarActionPerformed(evt);
            }
        });
        jMenu1.add(jMiCadastrar);

        jMiSair.setText("Sair");
        jMiSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMiSairActionPerformed(evt);
            }
        });
        jMenu1.add(jMiSair);

        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 908, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(14, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBtNovoAgendamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtNovoAgendamentoActionPerformed
        // TODO add your handling code here:
        jPnAgendamento.setVisible(true);
        
        jPnExame.setVisible(false);
        
        
        jBtNovoExame.setEnabled(false);
        jBtIternar.setEnabled(false);
    }//GEN-LAST:event_jBtNovoAgendamentoActionPerformed

    private void jBtNovoExameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtNovoExameActionPerformed
        // TODO add your handling code here:
        jPnExame.setVisible(true);
        jPnAgendamento.setVisible(false);
        jBtNovoAgendamento.setEnabled(false);
        
    }//GEN-LAST:event_jBtNovoExameActionPerformed

    private void jBtIternarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtIternarActionPerformed
        // TODO add your handling code here:
        CadInternacao cain = new CadInternacao();
        cain.setVisible(true);
    }//GEN-LAST:event_jBtIternarActionPerformed

    private void jBtCancelaExameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtCancelaExameActionPerformed
        // TODO add your handling code here:
        jPnExame.setVisible(false);
    }//GEN-LAST:event_jBtCancelaExameActionPerformed

    private void jBtCancelaAgendamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtCancelaAgendamentoActionPerformed
        // TODO add your handling code here:
        jPnAgendamento.setVisible(false);
    }//GEN-LAST:event_jBtCancelaAgendamentoActionPerformed

    private void jBtGravarAgendamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtGravarAgendamentoActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
    }//GEN-LAST:event_jBtGravarAgendamentoActionPerformed

    private void jTxtNomeAtendimentoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTxtNomeAtendimentoKeyTyped
        // TODO add your handling code here:
        if(!pap.tamanhoMaximo(100,jTxtNomeAtendimento.getText().length())){
            evt.consume();
        }
    }//GEN-LAST:event_jTxtNomeAtendimentoKeyTyped

    private void jMiCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMiCadastrarActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
    }//GEN-LAST:event_jMiCadastrarActionPerformed

    private void jMiSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMiSairActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
    }//GEN-LAST:event_jMiSairActionPerformed
        
    /**
     * @param args the command line arguments
     */

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtCancelaAgendamento;
    private javax.swing.JButton jBtCancelaExame;
    private javax.swing.JButton jBtGravarAgendamento;
    private javax.swing.JButton jBtGravarExame;
    private javax.swing.JButton jBtIternar;
    private javax.swing.JButton jBtNovoAgendamento;
    private javax.swing.JButton jBtNovoExame;
    private javax.swing.JButton jBtPesquisar;
    private javax.swing.JButton jBtReceita;
    private javax.swing.JComboBox jCbAgendamentosDoDia;
    private javax.swing.JComboBox jCbEspecialidadeAgendamento;
    private javax.swing.JComboBox jCbExame;
    private javax.swing.JLabel jLAgendamento;
    private javax.swing.JLabel jLAtendimento;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMiCadastrar;
    private javax.swing.JMenuItem jMiSair;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPnAgendamento;
    private javax.swing.JPanel jPnAtendimento;
    private javax.swing.JPanel jPnExame;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JTextArea jTaDescricaoAtendimento;
    private javax.swing.JTextArea jTaDescricaoExame;
    private javax.swing.JTable jTbAgendamento;
    private javax.swing.JTable jTbExame;
    private javax.swing.JFormattedTextField jTxtDataFinal;
    private javax.swing.JFormattedTextField jTxtDiaInicial;
    private javax.swing.JTextField jTxtNomeAtendimento;
    // End of variables declaration//GEN-END:variables
}
